package com.blog.cloud.monitor.controller;

import com.blog.cloud.core.utils.R;
import com.blog.cloud.monitor.vo.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/monitor")
public class MonitorController {

    /**
     * 获取服务器综合信息
     */
    @PostMapping("/serverInfo")
//    @PreAuthorize("hasAuthority('sys:monitor:serverInfo')")
    public R<Object> serverInfo() {
        ServerVO serverVO = new ServerVO();
        return R.ok(serverVO);
    }

    /**
     * 获取CPU信息
     */
    @PostMapping("/cpuInfo")
//    @PreAuthorize("hasAuthority('sys:monitor:cpuInfo')")
    public R<Object> cpuInfo() {
        CpuVO cpuVO = new CpuVO();
        return R.ok(cpuVO);
    }

    /**
     * 获取磁盘信息
     */
    @PostMapping("/diskInfo")
//    @PreAuthorize("hasAuthority('sys:monitor:diskInfo')")
    public R<Object> diskInfo() {
        ServerVO serverVO = new ServerVO("getDiskInfo");
        return R.ok(serverVO.getDisks());
    }

    /**
     * 获取JVM信息
     */
    @PostMapping("/jvmInfo")
//    @PreAuthorize("hasAuthority('sys:monitor:jvmInfo')")
    public R<Object> jvmInfo() {
        JvmVO jvmVO = new JvmVO();
        return R.ok(jvmVO);
    }

    /**
     * 获取内存信息
     */
    @PostMapping("/ramInfo")
//    @PreAuthorize("hasAuthority('sys:monitor:ramInfo')")
    public R<Object> ramInfo() {
        RamVO ramVO = new RamVO();
        return R.ok(ramVO);
    }

    /**
     * 获取操作系统信息
     */
    @PostMapping("/sysInfo")
//    @PreAuthorize("hasAuthority('sys:monitor:sysInfo')")
    public R<Object> sysInfo() {
        SysVO sysVO = new SysVO();
        return R.ok(sysVO);
    }

}
